package code.easylevel;

/**
 * @author Ashish Sonawane
 * Write a program which determines the sum of the first 1000 prime numbers.
 *
 */
public class SumOfPrimes {

	public static void main(String[] args) {

		int primeCounter = 0;
		int currentNumber = 2;
		int primeSum = 0;
		boolean isPrime = true;
		do{
			for(int i=2; i<=currentNumber/2; i++){
				if(currentNumber%i == 0){
					isPrime = false;
					break;
				}
			}
			if(isPrime){
				primeSum = primeSum+currentNumber;
				primeCounter++;
				currentNumber++;
			}else{
				currentNumber++;
				isPrime= true;
			}
		}while(primeCounter!=1000);
		System.out.println(primeSum);
	}

}
